<template>
  <div>
    <s-table
      ref="table"
      bordered
      :row-key="(record) => record.id"
      :columns="bbsColumns"
      :data="QuestionData"
    >
      <template slot="t_title" slot-scope="text, record">
        <a @click="toDetail(record.id)">{{ text }}</a>
      </template>
      <template slot="describe" slot-scope="text, record">
        <a @click="toDetail(record.id)">{{ text }}</a>
      </template>
      <template slot="action" slot-scope="text, record">
        <a-button size="small" type="primary" @click="toDetail(record.id)">查看</a-button>
      </template>
    </s-table>
  </div>
</template>

<script>
import { STable } from '@/components'
import { getQuestionList } from '@/api/bbs'
import col from '@/columns/bbs'
const bbsColumns = col.all

export default {
  components: {
    STable
  },
  name: 'All',
  data () {
    return {
      bbsColumns,
      QuestionData: parameters => {
        return getQuestionList(Object.assign(parameters, this.queryParam)).then(res => {
          return res.result
        })
      },
      queryParam: {}
    }
  },
  methods: {
    toDetail (id) {
      this.$router.push({ name: 'BBSDetail', params: { id: id } })
    }
  }
}
</script>

<style scoped>

</style>
